//
//  HomeModel.m
//  drug
//
//  Created by 沈鑫 on 16/4/6.
//  Copyright © 2016年 沈鑫. All rights reserved.
//

#import "HomeModel.h"

@implementation HomeModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"])
    {
        // ID与系统关键字重复 需要重新赋值
        [self setValue:value forKey:@"_id"];
    }
}


+ (NSMutableArray *)getData:(NSDictionary *)dic
{
    NSMutableArray *allArray = [NSMutableArray array];
    NSDictionary *bigDic = dic[@"list"];
    NSMutableArray *myArray = bigDic[@"types"];

  
    for (NSDictionary *dic in myArray)
    {
        NSMutableArray *myarray = dic[@"drug_list"];
        for (NSDictionary *dic1 in myarray)
        {
            HomeModel *model = [[HomeModel alloc]init];
            
            [model setValuesForKeysWithDictionary:dic1];
            
            [allArray addObject:model];
        }
        
    }
    
    
    return allArray;
}

@end
